package main

import (
	"log"
	"webgo/server"
	"webgo/server/ctrler"
	"webgo/server/plugin"
	"webgo/server/storage"
	"webgo/server/util"
)

func main() {

	util.SetLog(util.SYSTEM_LOG_LEVEL)
	util.SetCpu(util.SYSTEM_CPU_LIMIT)
	util.SetMen(util.SYSTEM_MEM_LIMIT)

	log.Println("loading..")

	util.Setup(plugin.Init)
	util.Setup(storage.Init)
	util.Setup(ctrler.Init)

	server.Main()

	log.Println("success to start!")

	util.Exit(func() {

		ctrler.Exit()
		storage.Exit()
		plugin.Exit()
	})
}
